﻿<?php
require_once("../../class2.php");
require_once("./includes/require_all.php");

$userer= USERNAME;
$usererid= USERID;
$catgame= mysql_real_escape_string($_GET['cg']);
$pref= $catgame;//mysql_fetch_array(mysql_query("SELECT Prefix FROM gcs_main WHERE Game='$catgame'"));
$mygame= mysql_fetch_array(mysql_query("SELECT UserID,g$pref FROM gcs_mygames WHERE UserNAME='$userer'"));
if (mysql_num_rows($mygame)==0) {
	mysql_query("INSERT INTO gcs_mygames(UserNAME,UserID) VALUES('$userer','$usererid')");
}
 
/*switch($mygame['g'.$pref]) {
	case '1': $vclass1='textGREEN'; break;
	case '2': $vclass2='textGREEN'; break;
	case '3': $vclass3='textGREEN'; break;
	case '4': $vclass4='textGREEN'; break;
}*/

if (isset($_GET['toexec'])) {
	mysql_query("UPDATE gcs_mygames SET g$pref='".mysql_real_escape_string($_GET['toexec'])."' WHERE UserNAME='$userer'");
}

$my = intval($mygame[1]);

if ($userer!='USERNAME') {
echo "<div id='result'>
			<table width=100% border=0 cellpadding=0 cellspacing=0>
				<tr>
				<td style='vertical-align:middle;'>
					<img src='gts/LEFT.png' style='display:block;' />
				</td>
				<td>";
				switch($my){
					case 0:
						echo "<img src='gts/WILL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/WILL_OFF.png'\" onmouseover=\"this.src='gts/WILL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />";
						echo "<img src='gts/PLAY_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/PLAY_OFF.png'\" onmouseover=\"this.src='gts/PLAY_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />";
						echo "<img src='gts/END_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/END_OFF.png'\" onmouseover=\"this.src='gts/END_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />";
						echo "<img src='gts/CANCEL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_OFF.png'\" onmouseover=\"this.src='gts/CANCEL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />";
						break;
					case 1:
						echo "<img src='gts/WILL_ON.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/WILL_ON.png'\" onmouseover=\"this.src='gts/WILL_ON_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />";
						echo "<img src='gts/PLAY_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/PLAY_OFF.png'\" onmouseover=\"this.src='gts/PLAY_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />";
						echo "<img src='gts/END_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/END_OFF.png'\" onmouseover=\"this.src='gts/END_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />";
						echo "<img src='gts/CANCEL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_OFF.png'\" onmouseover=\"this.src='gts/CANCEL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />";
						break;
					case 2:
						echo "<img src='gts/WILL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/WILL_OFF.png'\" onmouseover=\"this.src='gts/WILL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />";
						echo "<img src='gts/PLAY_ON.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/PLAY_ON.png'\" onmouseover=\"this.src='gts/PLAY_ON_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />";
						echo "<img src='gts/END_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/END_OFF.png'\" onmouseover=\"this.src='gts/END_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />";
						echo "<img src='gts/CANCEL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_OFF.png'\" onmouseover=\"this.src='gts/CANCEL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />";
						break;
					case 3:
						echo "<img src='gts/WILL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/WILL_OFF.png'\" onmouseover=\"this.src='gts/WILL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />";
						echo "<img src='gts/PLAY_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/PLAY_OFF.png'\" onmouseover=\"this.src='gts/PLAY_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />";
						echo "<img src='gts/END_ON.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/END_ON.png'\" onmouseover=\"this.src='gts/END_ON_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />";
						echo "<img src='gts/CANCEL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_OFF.png'\" onmouseover=\"this.src='gts/CANCEL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />";
						break;
					case 4:
						echo "<img src='gts/WILL_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/WILL_OFF.png'\" onmouseover=\"this.src='gts/WILL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />";
						echo "<img src='gts/PLAY_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/PLAY_OFF.png'\" onmouseover=\"this.src='gts/PLAY_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />";
						echo "<img src='gts/END_OFF.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/END_OFF.png'\" onmouseover=\"this.src='gts/END_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />";
						echo "<img src='gts/CANCEL_ON.png' style='display:block;cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_ON.png'\" onmouseover=\"this.src='gts/CANCEL_ON_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />";
						break;
				}
				/*echo "
					<img src='gts/WILL_OFF.png' style='cursor:pointer;' onmouseout=\"this.src='gts/WILL_OFF.png'\" onmouseover=\"this.src='gts/WILL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess') />
					<!--<div class='unselectable forumheader $vclass1' style='margin-left:-10px; margin-bottom:5px; padding:0px 15px; cursor:pointer;' onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=1','#result','#mygamess')>ще играя</div>-->
					<img src='gts/PLAY_OFF.png' style='cursor:pointer;' onmouseout=\"this.src='gts/PLAY_OFF.png'\" onmouseover=\"this.src='gts/PLAY_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess') />
					<!--<div class='unselectable forumheader $vclass2' style='margin-left:-10px; margin-bottom:5px; padding:0px 15px; cursor:pointer;' onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=2','#result','#mygamess')>сега играя</div>-->
					<img src='gts/END_OFF.png' style='cursor:pointer;' onmouseout=\"this.src='gts/END_OFF.png'\" onmouseover=\"this.src='gts/END_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess') />
					<!--<div class='unselectable forumheader $vclass3' style='margin-left:-10px; margin-bottom:5px; padding:0px 15px; cursor:pointer;' onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=3','#result','#mygamess')>изиграна</div>-->
					<img src='gts/CANCEL_OFF.png' style='cursor:pointer;' onmouseout=\"this.src='gts/CANCEL_OFF.png'\" onmouseover=\"this.src='gts/CANCEL_OFF_hover.png'\" onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess') />
					<!--<div class='unselectable forumheader $vclass4' style='margin-left:-10px; margin-bottom:5px; padding:0px 15px; cursor:pointer;' onclick=insertFromURL('gts-game-exec.php?cg=$catgame&toexec=4','#result','#mygamess')>недоиграна</div>-->
				*/
				echo "</td>
				</tr>
			</table>
	</div>";
}
?>